console.log("hl");
const EventEmitter = require('events')

function once(ee, fn) {
    return new Promise((resolve, reject) => {
        ee.resolve([{"value":name}])
    })
}

async function main(){
    const ee = new EventEmitter();
    setTimeout(() => { ee.emit('foobar', () => { console.log("Hello") }) }, 3000);
    let [value] = await once(ee, 'foobar');
    console.log(value);
}

main()